---@class WenheYanbing.Engine : Base.Engine
---@field public minions table<integer, WenheYanbing.Minion>
local Engine = Fk.Base.Engine:subclass("WenheYanbing.Engine")

function Engine:initialize()
    Fk.Base.Engine.initialize(self)
    
    self.minions = {}
    
    -- 定义随从ID常量（参考象棋的棋子ID命名）
    self.mZhugeLiang = 1
    self.mSimaYi = 2
    self.mCaoCao = 3
    self.mSunQuan = 4
    self.mLvBu = 5
    
    -- 升级费用表（参考象棋的固定数据）
    self.upgradeCosts = {0, 5, 7, 8, 9, 10}
end

function Engine:addMinion(minion)
    self.minions[minion.id] = minion
end

--@param id integer
--@return WenheYanbing.Minion
function Engine:getMinionById(id)
    return self.minions[id]
end

-- 获取特定等级的随从
function Engine:getMinionsByTier(tier)
    local result = {}
    for _, minion in pairs(self.minions) do
        if minion.tier == tier then
            table.insert(result, minion)
        end
    end
    return result
end

-- 获取升级费用
function Engine:getUpgradeCost(currentTier)
    return self.upgradeCosts[currentTier + 1] or 0
end

return Engine